package com.marvels.loanapply.channel.service;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.poi.hssf.usermodel.HSSFWorkbook;

import com.marvels.common.exception.MarvelsBusinessException;
import com.marvels.loanapply.channel.dto.ChannelUserListParamDTO;
import com.marvels.loanapply.channel.dto.ChannelUserListResultDTO;
import com.marvels.loanapply.channel.dto.SysUserDTO;
import com.marvels.loanapply.channel.dto.UserChannelInfo;
import com.marvels.loanapply.channel.dto.UserChannelInfoParamDTO;
import com.marvels.loanapply.channel.dto.UserChannelInfoResultDTO;
import com.marvels.loanapply.channel.dto.UserChannelRelation;
import com.marvels.loanapply.channel.dto.UserChannelRelationDTO;

public interface UserChannelInfoService {

	/**
	 * 新增用户渠道
	 * @param userChannelInfoParamDTO
	 * @return
	 * @throws MarvelsBusinessException
	 */
	void insertUserChannelInfo(UserChannelInfoParamDTO userChannelInfoParamDTO) throws MarvelsBusinessException;
	
	/**
	 * 操作用户渠道状态（开启  关闭）
	 * @param userChannelInfoParamDTO
	 * @return 当前状态
	 * @throws MarvelsBusinessException
	 */
	UserChannelInfoResultDTO operateChannelStatus(UserChannelInfoParamDTO userChannelInfoParamDTO) throws MarvelsBusinessException;
	
	/**
	 * 查询用户渠道列表
	 * @param userChannelInfoParamDTO
	 * @return
	 * @throws MarvelsBusinessException
	 */
	List<UserChannelInfoResultDTO> queryUserChannelList(UserChannelInfoParamDTO userChannelInfoParamDTO) throws MarvelsBusinessException;
	
	/**
	 * 查询渠道信息dto
	 * @param userChannelInfoParamDTO
	 * @return
	 * @throws MarvelsBusinessException
	 */
	UserChannelInfoResultDTO queryUserChannelDtoByCode(UserChannelInfoParamDTO userChannelInfoParamDTO) throws MarvelsBusinessException;
	
	/**
	 * 查询渠道信息实体类
	 * @param userChannelInfoParamDTO
	 * @return
	 * @throws MarvelsBusinessException
	 */
	UserChannelInfo queryUserChannelByCode(String channelCode) throws MarvelsBusinessException;
	
	/**
	 * 下载用户渠道列表
	 * @param userChannelInfoParamDTO
	 * @param request
	 * @param response
	 * @return
	 * @throws MarvelsBusinessException
	 * @throws IOException
	 */
	HSSFWorkbook downloadUserChannelExcel(UserChannelInfoParamDTO userChannelInfoParamDTO, HttpServletRequest request, HttpServletResponse response) throws MarvelsBusinessException, IOException;

	
	/**
	 * 查询该渠道的注册用户列表
	 * @param userChannelInfoParamDTO
	 * @return
	 * @throws MarvelsBusinessException
	 */
	List<ChannelUserListResultDTO> queryChannelRegisterUserList(ChannelUserListParamDTO channelUserListParamDTO) throws MarvelsBusinessException;
	
	/**
	 * 下载渠道的注册用户列表
	 * @param channelUserListParamDTO
	 * @param request
	 * @param response
	 * @return
	 * @throws MarvelsBusinessException
	 * @throws IOException
	 */
	HSSFWorkbook downloadChannelRegisterUserExcel(ChannelUserListParamDTO channelUserListParamDTO, HttpServletRequest request, HttpServletResponse response) throws MarvelsBusinessException, IOException;
	
	/**
	 * 生成渠道code
	 * @return
	 */
	String generatChannelCode() throws MarvelsBusinessException;
	
	/**
	 * 保存用户渠道关联信息
	 * @param list
	 */
	void saveUserChannelRelation(UserChannelRelationDTO dto) throws MarvelsBusinessException;
	
	/**
	 * 查询用户渠道关联信息
	 * @param dto
	 * @return
	 * @throws MarvelsBusinessException
	 */
	Map<String, Object> selectUserChannelRelation(UserChannelRelationDTO dto) throws MarvelsBusinessException;
	
	/**
	 * 获取系统用户列表
	 * @return
	 */
	List<SysUserDTO> selectSysUserList();
}
